package net.sxnic.item.zzdw.taglib;

import java.io.IOException;
import java.util.Map;

import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.BodyTagSupport;

import net.sxnic.comm.utils.CommUtils;
import net.sxnic.item.ItemConstants;

import org.apache.commons.lang.StringUtils;

/**
 * 组织单位根据编码显示名称 
 * @desp deptCodes单位编码可以是一个，也是可以多个，必选项
 * @author 孙宇飞
 *
 */
public class ZzdwNameTag extends BodyTagSupport{

	private static final long serialVersionUID = -3620111839909951992L;
	
	private String deptCode;
	
	public int doEndTag() {
		JspWriter out = pageContext.getOut();
		String deptName = "";
		Map<String, String> map = ItemConstants.VERIFY_DEPT_MAP;
		try {
			if (StringUtils.isBlank(deptCode)) {
				out.print("");
			} else {

				deptName = map.get(deptCode);
				
				if(StringUtils.isNotBlank(deptName))
					out.print(deptName);
				else
					out.print("");
			}

		} catch (IOException e) {
			
		}
		return EVAL_PAGE;
	}

	public String getDeptCode() {
		return deptCode;
	}

	public void setDeptCode(String deptCode) {
		this.deptCode = deptCode;
	}
	
}
